package com.leetcode.August;

import javax.swing.tree.TreeNode;

/**
 * @Description: 104. 二叉树的最大深度
 * @Author: Mr.Fxy
 * @CreateTime: 2024-08-29 21:02
 */
public class LC104二叉树的最大深度 {
    public int maxDepth(TreeNode root) {
        if (root == null) {
            return 0;
        } else {
            int leftHeight = maxDepth(root.left);
            int rightHeight = maxDepth(root.right);
            return Math.max(leftHeight, rightHeight) + 1;
        }
    }
}
